<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <link href="/img/logo.png" rel="shortcut icon">
	<title>YOYO.md Flash Games</title>
	<meta name="viewport" content="width=device-width">
	{{ HTML::style('css/menu.css') }}
	{{ HTML::style('css/general.css') }}
	{{ HTML::style('css/bootstrap.css') }}

</head>
<script>
  (function(d, s, id)
  {
    var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
  }
  
  (document, 'script', 'facebook-jssdk')
  );
    
  $(document).ready(function() {
    $(".game-wrap").hover(
      function () {
        var element = $(this).find('.play-game');
        element.removeClass("hidden");
      },
      function() {
        var element = $(this).find('.play-game');
        element.addClass("hidden");
      });
 });

</script>


<body>
  <div id="header">
<?php
    require_once $GLOBALS['laravel_paths']['app']  . "libraries/includes.php";
    
    
    
    PrintTopMenu();
    $max = DB::table('games')->max('views');
    $where = 'AND g.views='. $max;
    $topGames = Game::LoadGames($where);
    $topGame = $topGames[0];
    $topGameCategory = new Category($topGame->categoryId);
 ?>
    <div class="clear"></div>
    <div id="main-game-wrap">
      <div id="featured-game">
        <img src="<?php print $topGame->GenerateImageUrl('big'); ?>" width="550px" height="320px">
        <div class="alpha60">
						<h1><?php print HTML::link($topGame->GenerateGameUrl(), $topGame->title); ?></h1>
						<h2><?php print $topGameCategory->title?></h2>
						<?php print HTML::link($topGame->GenerateGameUrl(), $topGame->views . ' Views');?>
        </div>
      </div>
      <div class="fb-like-box" data-href="http://www.facebook.com/pages/yoyomd/255495234595482" data-width="292" data-height="320" data-show-faces="true" data-stream="false" data-border-color="#101030" data-header="false"></div>
    </div>
  </div>
  <div class="clear"></div>
  
  <div id="content">
    <div class="game-categories">
    <?php
      $games = Game::LoadGames();

      print '<ul id="top-games">';
      $index = 1;
      foreach($games as $game)
      {
        $class = 'game-wrap ';
        if( ($index+1) %3)
          $class = 'game-wrap';
        else
          $class .= 'center';
          
        $index++;
        ?>
      <li class="<?php print $class; ?>">
        <span class="thumnail"   style="background: url('<?php print $game->GenerateImageUrl('small') ?>') no-repeat scroll 0 0 transparent;"></span>
        <?php 
          print HTML::link($game->GenerateGameUrl(), $game->title, array('class' => 'play-game hidden'));
        ?>
        <span class="views hidden"><strong><?php print $game->views; ?></strong> Views</span>
      </li>
      <?php 
      }
      print '</ul>';
      
      ?>
    </div>
    
  </div>
  <div class="clear"></div>
  <?php PrintFooterPage(); ?>
  
</body>
</html>
      
      
